/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package atrevaluator;

import java.util.ArrayList;
import java.util.Formatter;
import java.util.Locale;

/**
 *
 * @author iknoth
 */
public class LatexTableExport {

    private ArrayList<String> files;
    private String path;
    
    public LatexTableExport(String path) {
        
        this.path = path;
        
    }

    public void setFiles(ArrayList<String> files) {
        this.files = files;
    }
     
    public void export(ArrayList<Integer> points) {
        
        InputOutput io = new InputOutput();
        
        ArrayList<ArrayList> result = new ArrayList<ArrayList>();
        
        StringBuilder sb = new StringBuilder();
        Formatter f = new Formatter(sb, Locale.UK);
        
        for (String file : files) {
                        
            ArrayList<String> oneFileArr = io.readFile(this.path + "/" + file);
            ArrayList<String> oneFileResult = new ArrayList<String>();
            System.out.println("Readind file: " + file);
            
            for (Integer point : points) {
                oneFileResult.add(oneFileArr.get(point));
                
            }
            
            result.add(oneFileResult);            
        }        
         
        for (int i = 0; i < points.size(); i ++) {
            
            for (int j = 0; j < result.size(); j ++) {
                ArrayList<String> tmp = (ArrayList<String>)result.get(j); 
                
                System.out.format("%10.2f & ", new Double(tmp.get(i)));
            }
            System.out.println();
            
        }
        
    }
    
}
